#include "json.h"

/** stream JSON to binary stream */
int main(void)
	{
	DataStream stream=NULL;
	int status=EXIT_SUCCESS;
	
	//parses the input
	JSONNodePtr root=jsonParseFile(stdin);
	//serialize json to binary
	if(root!=NULL && (stream=JSONSerialize(root))!=NULL)
		{
		fwrite(
			DataStreamData(stream),
			DataStreamSize(stream),
			1,stdout);
		fflush(stdout);	
		}
	else
		{
		status= EXIT_FAILURE;
		}
	DataStreamFree(stream);
	JSONNodeFree(root);
	return status;
	}